package com.maybach.core.manager.impl;

import com.maybach.common.model.OrderInfoDO;
import com.maybach.common.query.OrderInfoQuery;
import com.maybach.core.dal.mapper.ext.OrderInfoExtMapper;
import com.maybach.core.manager.OrderInfoManager;
import com.maybach.util.query.support.PageResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for OrderInfo.
 */

@Component
public class OrderInfoManagerImpl implements OrderInfoManager{
    protected Logger log = LoggerFactory.getLogger(this.getClass());

    
    @Autowired
    protected OrderInfoExtMapper orderInfoExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(OrderInfoQuery query){
        return orderInfoExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(OrderInfoQuery query){
        return orderInfoExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(OrderInfoDO record){
        return orderInfoExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(OrderInfoDO record){
        return orderInfoExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<OrderInfoDO> selectByQuery(OrderInfoQuery query){
        return orderInfoExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<OrderInfoDO> selectByQueryWithPage(OrderInfoQuery query) {
        PageResult<OrderInfoDO> result = new PageResult<OrderInfoDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public OrderInfoDO selectByPrimaryKey(Long id){
        return orderInfoExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( OrderInfoDO record,  OrderInfoQuery query){
        return orderInfoExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( OrderInfoDO record,  OrderInfoQuery query){

        return orderInfoExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(OrderInfoDO record){
        return orderInfoExtMapper.updateByPrimaryKeySelective(record);
    }
}